package com.pushtime.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.net.URI;
import java.time.Instant;
import java.util.Objects;

/**
 * HDFS 上传/下载日志表
 */
@ApiModel(description = "HDFS 上传/下载日志表")
@Entity
@Table(name = "hdfs_log")
public class HdfsLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 名称
     */
    @Size(max = 20)
    @ApiModelProperty(value = "名称")
    @Column(name = "name", length = 20)
    private String name;

    /**
     * 源地址
     */
    @Size(max = 512)
    @ApiModelProperty(value = "源地址")
    @Column(name = "src", length = 512)
    private String src;

    /**
     * 目标地址
     */
    @Size(max = 512)
    @ApiModelProperty(value = "目标地址")
    @Column(name = "dst", length = 512)
    private String dst;

    /**
     * 文件总大小
     */
    @ApiModelProperty(value = "文件总大小")
    @Column(name = "total_size")
    private Long totalSize;

    /**
     * 已经完成大小
     */
    @ApiModelProperty(value = "已经完成大小")
    @Column(name = "current_size")
    private Long currentSize;

    /**
     * 进度
     */
    @ApiModelProperty(value = "进度")
    @Column(name = "process")
    private Double process;

    /**
     * 状态 {1:队列中,2:失败}
     */
    @ApiModelProperty(value = "状态 {1:队列中,2:失败}")
    @Column(name = "state")
    private Integer state;

    /**
     * 描述信息
     */
    @Size(max = 512)
    @ApiModelProperty(value = "描述信息")
    @Column(name = "jhi_desc", length = 512)
    private String desc;

    /**
     * 创建日期
     */
    @ApiModelProperty(value = "创建日期")
    @Column(name = "created_date")
    private Instant createdDate;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public HdfsLog name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSrc() {
        return src;
    }

    public HdfsLog src(String src) {
        this.src = src;
        return this;
    }

    public void setSrc(String src) {
        this.src = src;
    }

    public String getDst() {
        return dst;
    }

    public HdfsLog dst(String dst) {
        this.dst = dst;
        return this;
    }

    public void setDst(String dst) {
        this.dst = dst;
    }

    public Long getTotalSize() {
        return totalSize;
    }

    public HdfsLog totalSize(Long totalSize) {
        this.totalSize = totalSize;
        return this;
    }

    public void setTotalSize(Long totalSize) {
        this.totalSize = totalSize;
    }

    public Long getCurrentSize() {
        return currentSize;
    }

    public HdfsLog currentSize(Long currentSize) {
        this.currentSize = currentSize;
        return this;
    }

    public void setCurrentSize(Long currentSize) {
        this.currentSize = currentSize;
    }

    public Double getProcess() {
        return process;
    }

    public HdfsLog process(Double process) {
        this.process = process;
        return this;
    }

    public void setProcess(Double process) {
        this.process = process;
    }

    public Integer getState() {
        return state;
    }

    public HdfsLog state(Integer state) {
        this.state = state;
        return this;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getDesc() {
        return desc;
    }

    public HdfsLog desc(String desc) {
        this.desc = desc;
        return this;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Instant getCreatedDate() {
        return createdDate;
    }

    public HdfsLog createdDate(Instant createdDate) {
        this.createdDate = createdDate;
        return this;
    }

    public void setCreatedDate(Instant createdDate) {
        this.createdDate = createdDate;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        HdfsLog hdfsLog = (HdfsLog) o;
        if (hdfsLog.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), hdfsLog.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "HdfsLog{" +
            "id=" + getId() +
            ", name='" + getName() + "'" +
            ", src='" + getSrc() + "'" +
            ", dst='" + getDst() + "'" +
            ", totalSize=" + getTotalSize() +
            ", currentSize=" + getCurrentSize() +
            ", process=" + getProcess() +
            ", state=" + getState() +
            ", desc='" + getDesc() + "'" +
            ", createdDate='" + getCreatedDate() + "'" +
            "}";
    }
}
